from fastapi import Request, APIRouter
from fastapi.templating import Jinja2Templates
from fastapi.responses import HTMLResponse
import os
from fastapi.staticfiles import StaticFiles

templates_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
                              "templates")
# print(static_path)
templates = Jinja2Templates(directory=templates_path)  #加载模板

render = APIRouter()


@render.get("/render_html", response_class=HTMLResponse)
async def render_html(request: Request):
    return templates.TemplateResponse("llm_chat_html.html",
                                      {"request": request})
